<template>
    <div style="overflow: hidden;">
        <div class="demo-date-picker" style="height: 50px;">
            <div class="block">
                <el-row>
                    <el-col :span="4">
                        <el-form-item label="选择时间段">
                            <!-- <el-text tag="mark" style="margin: 0px 10px 0px 20px;">选择时间段</el-text> -->
                            <el-date-picker v-model="startDate1" id="startDate1" type="date" placeholder="选择日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item>
                            <el-date-picker v-model="endDate1" id="endDate1" align="right" type="date" placeholder="选择日期"
                                :picker-options="pickerOptions" @blur="BlurMap"></el-date-picker></el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="选择机台">
                            <!-- <el-text tag="mark" style="margin: 0px 10px 0px 20px;">选择机台</el-text> -->
                            <el-select :style="{ width: '250px' }" collapse-tags filterable multiple
                                v-model="objectOP.payItem" @focus="focusSelopen(1)" @change="BlurMap">
                                <el-option v-for="item in pageData.nameOpen" :value="item['machineCode']">{{
                                    item['machineCode']
                                }}</el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="织布单号">
                            <!-- <el-text tag="mark" style="margin: 0px 10px 0px 20px;">织布单号</el-text> -->
                            <el-select :style="{ width: '250px' }" collapse-tags filterable multiple
                                v-model="objectOP.planOrderCodes" @focus="focusShelve5" @change="BlurMap">
                                <el-option v-for="item in pageData.ZBoptions" :value="item">{{
                                    item
                                }}</el-option>
                            </el-select></el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item>
                            <el-button type="primary" style="margin-left: 20px;" @Click="dataInfoList1">查询</el-button>
                            <el-button type="primary" style="margin-left: 20px;" @Click="dataInfoListBC"
                                v-if="objectOP.BCoption">保存</el-button>
                            <!-- <el-button v-if="objectOP.JToption" type="primary" style="margin-left: 20px;"
                                @Click="dataInfoListaJT">新增机台</el-button> -->
                        </el-form-item>
                    </el-col>
                </el-row>
            </div>
        </div>
        <div class="container">
            <a-split :style="{
                height: '90%',
                width: '100%',
                minWidth: '317px',
                border: '1px solid var(--color-border)'
            }" v-model:size="size" min="80px">
                <template #first>
                    <a-typography-paragraph>
                        <div class="left" ref="left">
                            <!-- <div class="drag" data-info="1" id="LeftTopDiv"> -->
                            <a-form>
                                <a-form-item id="LeftTopDiv" label="织布单号" style="width: 300px;" label-col-flex="68px">
                                    <!-- <a-select popup-container="html"  v-model="pageData.ZBoption" style="width: 150px;" allow-clear @focus="focusShelve5"
                            @search="handleSearchopen5">
                            <a-option v-for="(item, index) in pageData.ZBoptions" :key="index" :label="item"
                                :value="item" />
                        </a-select> -->
                                    <a-input v-model="pageData.ZBoption" style="width: 150px;" />
                                    <el-button style="width: 65px;" type="primary" @click="POquery">查询</el-button>
                                </a-form-item>
                            </a-form>
                            <!-- </div> -->

                            <!-- <div class="drag" data-info="1" v-for="(item, index) in dataList" :key="index">{{
                    item.planOrderCode }}
                    <el-button type="primary" style="float:right;" @click="handleButtonClick(item)">排产</el-button>
                </div> -->
                            <div style="height:100%">
                                <a-spin :loading="pageData.pageLoading" tip="加载中" dot
                                    style="height: 100%; width: 100%; z-index: 999">
                                    <AgGridVuesCopys :rowHeight="33" :headerHeight="33" :suppressCopyRowsToClipboard="true" rowSelection="multiple"
                                        @grid-ready="gridReady" style="height: 93%" :defaultColDef="defaultColDef"
                                        class="ag-theme-alpine" :rowData="tableDataList" :columnDefs="tc"
                                        :localeText="localeText1" @dblclick="agCellClicks"></AgGridVuesCopys>
                                </a-spin>
                            </div>
                            <!-- <div class="drag" data-info="2">PO信息2</div>
                <div class="drag" data-info="3">PO信息3</div>
                <div class="drag" data-info="4">PO信息4</div>
                <div class="drag" data-info="5">PO信息5</div>
                <div class="drag" data-info="6">PO信息6</div>
                <div class="drag" data-info="7">PO信息7</div>
                <div class="drag" data-info="8">PO信息8</div>
                <div class="drag" data-info="9">PO信息9</div>
                <div class="drag" data-info="10">PO信息10</div>
                <div class="drag" data-info="11">PO信息11</div>
                <div class="drag" data-info="12">PO信息12</div>
                <div class="drag" data-info="13">PO信息13</div>
                <div class="drag" data-info="14">PO信息14</div>
                <div class="drag" data-info="21">PO信息21</div>
                <div class="drag" data-info="22">PO信息22</div>
                <div class="drag" data-info="23">PO信息23</div>
                <div class="drag" data-info="24">PO信息24</div>
                <div class="drag" data-info="25">PO信息25</div>
                <div class="drag" data-info="26">PO信息26</div>
                <div class="drag" data-info="27">PO信息27</div>
                <div class="drag" data-info="28">PO信息28</div>
                <div class="drag" data-info="29">PO信息29</div>
                <div class="drag" data-info="30">PO信息30</div> -->

                        </div>
                    </a-typography-paragraph>
                </template>
                <template #second>
                    <a-typography-paragraph>
                        <div class="right" id="right" style="overflow-y: scroll;overflow-x: scroll;">
                            <div class="gantt-chart"></div>
                        </div>
                    </a-typography-paragraph>
                </template>
            </a-split>


        </div>
        <el-dialog align-center style="width: 500px" v-model="objectOP.dialogFormVisible" v-loading="loadingElplus">
            <el-form>
                <div>
                    <el-radio-group v-model="pageData.radio" class="radioOP">
                        <el-radio :label="0" @click="ZDmap">自动</el-radio>
                        <el-radio :label="1">手动</el-radio>
                    </el-radio-group>
                </div>
                <div>
                    <el-form-item label="机台">
                        <el-select v-model="pageData.option" filterable multiple style="width: 240px"
                            :disabled="pageData.radio == 0" allow-clear @focus="focusShelve1"
                            @change="changeShelve1($event)">
                            <el-option v-for="(item, index) in pageData.options" :key="index" :label="item.machineCode"
                                :value="item.machineCode" />
                        </el-select>
                    </el-form-item>
                </div>
                <div v-for="(item, index) in pageData.changeList" :key="index" style="margin-top: 30px;">
                    <div style="margin: 5px 0px;float: left;font-size: 16px;">机台 {{ item.machineCode }} 数量:</div>

                    <a-input-number :min="0" v-model="item.alreadyWeight" :disabled="pageData.radio == 0"
                        style="float: left; width: 340px;margin-bottom: 5px;" @blur="changeOpen(item)" />
                    <div style="float: left;width: 100%;"><span v-if="item.rowsState == 1" style="color: red;">机台 {{
                        item.machineCode }} 已超期</span>
                    </div>
                </div>
                <div style="float: left;"><span style="color: #158bb8;"> 总数量 ： {{ pageData.onlyTotal }}</span></div>
            </el-form>

            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="saOut">取消</el-button>
                    <el-button type="primary" @click="save"> 确认 </el-button>
                </span>
            </template>
        </el-dialog>
        <!-- 托拉拽任务操作对话框 -->
        <el-dialog align-center style="width: 500px" v-model="objectOP.dialogFormVules" v-loading="loadingElplus">
            <el-form>
                <div v-for="(item, index) in pageData.taskList" :key="index">
                    <!-- <div style="margin: 5px 0px;float: left;font-size: 16px;">{{ item.name + "/" + item.num }} ：</div>

                    <a-time-picker v-model="item.alreadyWeight" style="float: left; width: 160px;margin-bottom: 5px;" /> -->
                    <el-checkbox :disabled="item.productionState >= 2" @change="getItemStatus($event, item)"
                        size="large" />&nbsp;&nbsp;{{ item.name + "/" +
                            item.num }}
                </div>
            </el-form>

            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="saveOut">取消</el-button>
                    <el-button type="primary" @click="saveOpen(1)"> 确认 </el-button>
                </span>
            </template>
        </el-dialog>
        <!-- 多选任务操作对话框 -->
        <el-dialog align-center style="width: 500px" v-model="objectOP.dialogFormVules1" v-loading="loadingElplus">
            <el-form>
                <div v-for="(item, index) in pageData.taskList2" :key="index">
                    <el-checkbox @change="getItemStatus($event, item)" size="large" />&nbsp;&nbsp;{{ item.name + "/" +
                        item.num }}
                </div>
            </el-form>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="saveOut1">取消</el-button>
                    <el-button type="primary" @click="saveOpen1"> 确认 </el-button>
                </span>
            </template>
        </el-dialog>
        <!-- 弹出框选项 -->
        <!-- <el-dialog align-center style="width: 500px" v-model="objectOP.dialogFormVules2" v-loading="loadingElplus"> -->
        <!-- <span class="dialog-button">
                <el-button @click="ZDclick" style="width: 120px;height: 60px;">整单</el-button>
                <el-button type="primary" @click="CFclick" style="width: 120px;height: 60px;"> 拆分 </el-button>
            </span> -->
        <!-- <el-dialog v-model="objectOP.dialogFormVules2"> -->
        <div class="div_button" v-show="objectOP.dialogFormVules2" @mouseleave="objectOPmouseleave" :style="{
            top: pageData.contextMenuPosition.top - 105 + 'px',
            left: pageData.contextMenuPosition.left - 250 + 'px',
        }">
            <div class="hoverDiv"><el-button @click="ZDclick" style="width: 80px;height: 40px;">整单</el-button></div>
            <div class="hoverDiv"><el-button type="primary" @click="CFclick" style="width: 80px;height: 40px;"> 拆分
                </el-button></div>
        </div>
        <!-- </el-dialog> -->
        <!-- 整件选项弹出框 -->
        <el-dialog align-center style="width: 500px" v-model="objectOP.dialogFormVules3" v-loading="loadingElplus">
            <div style="width: 100%;display: flex;align-items: center;justify-content: center;"><span
                    style="width: 100%; text-align: center;color: red;">任务：{{ objectOP.planOrderCode
                    }}&nbsp;&nbsp;&nbsp;机台：{{ objectOP.machineCode }}</span>
            </div>
            <el-divider />
            <div>
                <el-table border ref="multipleTableRef" :data="pageData.taskList3" style="width: 100%;height: 300px;"
                    @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="55" :selectable="isRowSelectable" />
                    <el-table-column prop="planOrderCode" label="任务名" width="150" />
                    <el-table-column prop="startTime" label="开始时间" width="170" />
                    <el-table-column prop="scheduleWeight" label="数量" />
                </el-table>
            </div>
            <el-divider />
            <div>
                <el-form ref="ruleFormRef" :model="objectOP" :rules="rules" status-icon>
                    <el-form-item label="机台:" style="margin-left: 28px;" prop="option2">
                        <el-select v-model="objectOP.option2" filterable style="width: 240px" allow-clear
                            @focus="focusSelopen(1)">
                            <el-option v-for="(item, index) in pageData.nameOpen" :key="index" :label="item.machineCode"
                                :value="item.machineCode" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="选择日期:" prop="dayN2">
                        <el-date-picker style="width: 240px" v-model="objectOP.dayN2" />
                    </el-form-item>
                </el-form>
            </div>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="saveOut2">取消</el-button>
                    <!-- <el-button type="primary" @click="saveOpen2"> 确认 </el-button> -->
                    <el-button type="primary" @click="saveOpen(2)"> 确认 </el-button>
                </span>
            </template>
        </el-dialog>
        <!-- 拆分选项弹出框 -->
        <el-dialog align-center style="width: 500px" v-model="objectOP.dialogFormVules4" v-loading="loadingElplus">
            <div>
                <div style="width: 100%;display: flex;align-items: center;justify-content: center;"><span
                        style="width: 100%; text-align: center;color: red;">任务：{{ objectOP.planOrderCode
                        }}&nbsp;&nbsp;&nbsp;机台：{{ objectOP.machineCode }}</span>
                </div>
                <div style="width: 100%;display: flex;align-items: center;justify-content: center;margin-top: 20px;">
                    <el-form status-icon>
                        <el-form-item label="原有重量">
                            <el-input-number disabled v-model="objectOP.YyWeight" style="width: 300px;" />
                        </el-form-item>
                        <el-form-item label="拆分重量">
                            <el-input-number :min="0" :max="objectOP.YyWeight" v-model="objectOP.CfWeight"
                                style="width: 300px;" />
                        </el-form-item>
                    </el-form>
                </div>
            </div>
            <el-divider />
            <div style="width: 100%;display: flex;align-items: center;justify-content: center;">
                <el-form ref="ruleFormRef" :model="objectOP" :rules="rules" status-icon>
                    <el-form-item label="机台:" style="margin-left: 28px;" prop="option4">
                        <el-select v-model="objectOP.option4" filterable style="width: 300px" allow-clear
                            @focus="focusSelopen(1)">
                            <el-option v-for="(item, index) in pageData.nameOpen" :key="index" :label="item.machineCode"
                                :value="item.machineCode" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="选择日期:" prop="dayN4">
                        <el-date-picker style="width: 300px" v-model="objectOP.dayN4" />
                    </el-form-item>
                </el-form>
            </div>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="saveOut4">取消</el-button>
                    <el-button type="primary" @click="saveOpen4"> 确认 </el-button>
                </span>
            </template>
        </el-dialog>
        <el-dialog align-center style="width: 500px" v-model="objectOP.dialogFormVules5" v-loading="loadingElplus">
            <div style="width: 100%;overflow-wrap: break-word;">
                已选机台：<span v-for="(item) in objectOP.option5" style="margin-left: 10px;color: red;">{{ item }}</span>
            </div>
            <el-divider />
            <div style="width: 100%;display: flex;align-items: center;justify-content: center;">
                <el-form :model="objectOP" status-icon>
                    <el-form-item label="机台:" style="margin-left: 28px;">
                        <el-select collapse-tags filterable multiple v-model="objectOP.option5" style="width: 300px"
                            allow-clear @focus="focusSelopen(2)">
                            <el-option v-for="(item, index) in pageData.nameOpen" :key="index" :label="item.machineCode"
                                :value="item.machineCode" />
                        </el-select>
                    </el-form-item>
                </el-form>
            </div>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="saveOut5">取消</el-button>
                    <el-button type="primary" @click="saveOpen5"> 确认 </el-button>
                </span>
            </template>
        </el-dialog>
        <el-dialog align-center style="width: 500px" v-model="objectOP.dialogFormVules6" v-loading="loadingElplus">
            <div style="width: 100%;overflow-wrap: break-word;">
                <span style="color: red;text-align: center;"> 订单数据已超期，是否继续操作？ </span>
            </div>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="saveOut6">取消</el-button>
                    <el-button type="primary" @click="saveOpen6"> 确认 </el-button>
                </span>
            </template>
        </el-dialog>
    </div>
    <div v-show="false">
        <EmbroideryList2></EmbroideryList2>
    </div>
</template>
<script setup>
import { ref, reactive, onMounted, nextTick } from 'vue'
import { post } from '@/api/http'
import { Form, Message, Modal, Pagination } from "@arco-design/web-vue";
import dayjs from 'dayjs'
// import { FormInstance } from '@arco-design/web-vue/es/form'
import { localeText } from '@/api/aggridZw'
import { pagingList } from '@/api/paging'
import emitter from '@/hooks/useEventBus'
import EmbroideryList2 from '@/components/processrowfactory/components/EmbroideryList2.vue'
//import $ from 'jquery'//npm install jquery --save
// import draggable from "vuedraggable";//npm i -S vuedraggable@next

const gridOption = ref()
const gridReady = (params) => {
    gridOption.value = params.api
}
const defaultColDef = {
    sortable: true,
    resizable: true,
    filter: true,
}
const localeText1 = ref(localeText)
const tableDataList = ref([])
const size = ref(317)
const tc = [
    {
        headerName: '织布单号',
        field: 'planOrderCode',
        width: 150,
        filter: 'planOrderCode',
    },
    {
        headerName: '开单时间',
        field: 'createTime',
        width: 150
    },
    {
        headerName: '急单',
        field: 'planOrderState',
        width: 150,
        cellRenderer: {
            template: `
            <a-space>
                <el-tag style="background-color: green;color: #fff;" v-if="isDatas.planOrderState == 0">
                          正常
                        </el-tag>
                        <el-tag style="color: red;" v-if="isDatas.planOrderState == 1">
                            &nbsp&nbsp急&nbsp&nbsp
                        </el-tag>
                        <el-tag style="background-color: red;color: #fff;" v-if="isDatas.planOrderState == 2">
                          紧急
                        </el-tag>
            </a-space>
            `,
            setup(props) {
                const isDatas = ref(props.params.data)
                return {
                    isDatas,
                }
            }
        }
    },
    {
        headerName: '客户名称',
        field: 'customName',
        width: 150
    },
    {
        headerName: '坯布编号',
        field: 'greyCode',
        width: 150
    },
    {
        headerName: '针寸数',
        field: 'workDrum',
        width: 150
    },
    {
        headerName: '坯布批号',
        field: 'greyBatchNo',
        width: 150
    },
    {
        headerName: '颜色',
        field: 'colorName',
        width: 150
    },
    {
        headerName: '坯布名称',
        field: 'greyName',
        width: 150
    },
    {
        headerName: '纱长',
        field: 'yarnLong',
        width: 150
    },
    {
        headerName: '指令重量',
        field: 'orderWeight',
        width: 150
    },
    {
        headerName: '织造交期',
        field: 'orderDeliveryDate',
        width: 150
    },
    {
        headerName: '已排重量',
        field: 'pmtWeight',
        width: 150
    },
    {
        headerName: '未排重量',
        field: 'noPmtWeight',
        width: 150
    },
    {
        headerName: '操作',
        field: 'id',
        pinned: 'right',
        width: 80,
        cellRenderer: {
            template: `
            <el-button style="color:#165dff;" @click="a" class="gesture" link>排产</el-button>
            `,
            setup(props) {
                const a = (e) => {
                    e.stopPropagation()
                    handleButtonClick(props.params.data)
                }
                return {
                    a
                }
            }
        }
    }
]

const ruleFormRef = ref()
const dialogFormVisible = false
const loadingElplus = ref(false)
const dataList = ref([])
const objectOP = reactive({
    openList: [],
    dialogFormVisible: false,
    objectMap: '',
    inputMap: '',
    dialogFormVules: false,
    divList: [],
    // 获取被拖动的数据(旧)
    data: '',
    //日期(旧)
    date: '',
    //任务合并的名称(旧)
    taskName: '',
    //机台(旧)
    jt: '',
    //任务合并的名称(新)
    taskName1: '',
    //日期(新)
    date1: '',
    //机台(新)
    jt1: '',
    payItem: [],
    registerDate: '',
    dialogFormVules1: false,
    dialogFormVules2: false,
    dialogFormVules3: false,
    dialogFormVules4: false,
    dialogFormVules5: false,
    machineCode: '',
    planOrderCode: '',
    planOrderCodes: [],
    option2: '',
    option4: [],
    option5: [],
    dayN2: '',
    num2: null,
    YyWeight: '',
    CfWeight: '',
    JToption: false,
    dialogFormVules6: false,
    BCoption: false,
    productionState: null,
    taskList1: []
})
const pageData = reactive({
    radio: 0,
    loading: false,
    ZBoption: '',
    ZBoptions: [],
    option: '',
    options: [],
    changeList: [],
    jtdtBiao: [],
    dataListOpen: [],
    inputListOpen: [],
    onlyTotal: '',
    dataInfoList: [],
    //任务详情数组(旧)
    taskList: [],
    //任务详情数组(新)
    taskList1: [],
    // 页面渲染数据
    dataInfo: [],
    nameOpen: [],
    taskList2: [],
    taskList3: [],
    contextMenuPosition: {},
    listMach: [],
    oldList: [],
    newList: [],

})
const multipleTableRef = ref()
const multipleSelection = ref([])

// 机台下拉框接口(手动)
const focusShelve1 = async () => {
    try {
        pageData.loading = true
        let { code, data, message } = await post({
            url: 'planSingle/planSchedul/getAutoScheduleInfo',
            data: objectOP.objectMap,
        })
        if (code == 200) {
            pageData.options = data.machineData
            pageData.loading = false
            return
        }
        Message.error({
            content: message,
            duration: 5000,
        })
    } finally {
        pageData.loading = false
    }
}
const changeShelve1 = (resf) => {
    // pageData.changeList = resf
    // // pageData.changeList = pageData.option

    const matchingElements = pageData.options.filter((item) => {
        return resf.includes(item.machineCode);
    });
    // console.log(resf, matchingElements, '嘴角那滴没落下的泪');
    post({
        url: 'planSingle/planSchedul/getScheduleCalculate',
        data: {
            ...objectOP.objectMap,
            taskDetail: pageData.jtdtBiao,
            machine: matchingElements,
            alreadySchedulingNum: objectOP.objectMap.orderWeight,
            lastDeliveryTime: objectOP.objectMap.orderDeliveryDate,
            planSchedulId: objectOP.objectMap.id,
            weavDeliveryDate: objectOP.objectMap.orderDeliveryDate,
            calculateData: []
        },
    }).then(({ data, code, message }) => {
        if (code === 200) {
            pageData.changeList = data
            // console.log(pageData.changeList)
        } else {
            Message.error({
                content: message,
                duration: 5000,
            })
        }
    })

}
// const inputChange = (res) => {
//     let time = Date.parse(dayjs(res).format('YYYY-MM-DD HH:mm:ss'))
//     let time1 = Date.parse(dayjs().format('YYYY-MM-DD HH:mm:ss'))
//     if(time<time1){

//     }
//     console.log(time, time1, '111111111111');
// }

const changeOpen = (val) => {
    // console.log(val);
    // if (pageData.listMach.length != 0) {
    //     pageData.listMach.forEach((res, index) => {
    //         if (res.id == val.id) {
    //             pageData.listMach[index] = val
    //         } else {
    //             pageData.listMach.push(val)
    //         }
    //     })
    // } else {
    //     pageData.listMach.push(val)
    // }
    // pageData.changeList.filter(item => {
    //     return item.id == 
    // })
    pageData.changeList.filter(item => {
        // 查找新数组中是否已存在相同 id 的元素
        const existingItemIndex = pageData.inputListOpen.findIndex(el => el.id === item.id);
        // console.log(existingItemIndex, item, '我看看');
        if (val.alreadyWeight == item.alreadyWeight) {
            if (existingItemIndex !== -1) {
                // 如果已存在相同 id 的元素，则替换为最新的更改内容
                pageData.inputListOpen[existingItemIndex] = item;
            } else {
                // 如果新数组中不存在相同 id 的元素，则将该元素添加到新数组
                pageData.inputListOpen.push(item);
            }
        }
    });
    post({
        url: 'planSingle/planSchedul/getScheduleCalculate',
        data: {
            ...objectOP.objectMap,
            taskDetail: pageData.jtdtBiao,
            machine: pageData.changeList,
            alreadySchedulingNum: objectOP.objectMap.orderWeight,
            lastDeliveryTime: objectOP.objectMap.orderDeliveryDate,
            planSchedulId: objectOP.objectMap.id,
            weavDeliveryDate: objectOP.objectMap.orderDeliveryDate,
            calculateData: pageData.inputListOpen
            // calculateData: pageData.listMach
        },
    }).then(({ data, code, message }) => {
        if (code === 200) {
            let list = JSON.parse(JSON.stringify(pageData.changeList))
            list.forEach((res, index) => {
                data.forEach((resz) => {
                    if (res.id == resz.id) {
                        pageData.changeList[index] = resz
                    }
                })
            })

        } else {
            val.alreadyWeight = 0
            Message.error({
                content: message,
                duration: 5000,
            })
        }
    })
}
onMounted(() => {
    innerH()
    window.addEventListener("resize", innerH)
    listMapOb()
    POquery()
    // dateInfo()
})
const listMapOb = () => {
    nextTick(() => {
        let t1 = dayjs().format('YYYY-MM-DD')
        let t3 = (Date.parse(t1) / 1000 + 604800) * 1000
        let t2 = dayjs(t3).format('YYYY-MM-DD')
        // console.log(t2, t1, '111111111111');
        document.querySelector("#startDate1").value = t1 //开始日期
        document.querySelector("#endDate1").value = t2 //结束日期
    })

}
const POquery = () => {
    // PO信息查询
    post({
        url: "planSingle/planSchedul/getSchedulInfo",
        data: { planOrderCode: pageData.ZBoption, schedulstate: 0 }
    }).then(({ data, code }) => {
        if (code === 200) {

            // objectOP.openList = data;
            tableDataList.value = data
        } else {
            Message.error({
                content: "查询失败！",
                duration: 5000,
            });
        }
    });
}
const handleButtonClick = (resf) => {
    pageData.option = []
    pageData.changeList = []
    pageData.onlyTotal = 0
    objectOP.objectMap = resf
    pageData.inputListOpen = []
    objectOP.dialogFormVisible = true
    pageData.listMach = []
    ZDmap()
}
const focusSelopen = (val) => {
    post({
        url: "planSingle/machine/getFieldValue3",
        data: { machineCode: '' }
    }).then(({ data, code }) => {
        if (code === 200) {
            if (val === 2) {
                // pageData.nameOpen = data.filter(item => !pageData.dataInfo.includes(item));
                pageData.nameOpen = data.filter(item => {
                    const option = pageData.dataInfo.find(obj => obj.name === item.machineCode);
                    return option === undefined || option.name !== item.machineCode;
                });
                // console.log(pageData.nameOpen, '看看筛选成功了没');
            } else if (val === 3) {
                pageData.nameOpen = pageData.dataInfo.filter(item => {
                    return item.name
                })

            } else {
                pageData.nameOpen = data;
            }
        } else {
            Message.error({
                content: "查询失败！",
                duration: 5000,
            });
        }
    });
}

// 自动选项
const ZDmap = () => {
    post({
        url: 'planSingle/planSchedul/getAutoScheduleInfoG',
        data: objectOP.objectMap,
    }).then(({ data, code, message }) => {
        if (code === 200) {
            pageData.dataListOpen = data.machineData
            pageData.option = pageData.dataListOpen.map((item) => {
                return item.machineCode
            })
            // pageData.changeList = pageData.option
            post({
                url: 'planSingle/planSchedul/getScheduleInfoByMachine',
                data: data.machineData,
            }).then(({ data, code, message }) => {
                if (code === 200) {
                    pageData.jtdtBiao = data
                    post({
                        url: 'planSingle/planSchedul/getScheduleCalculate',
                        data: {
                            ...objectOP.objectMap,
                            taskDetail: pageData.jtdtBiao,
                            machine: pageData.dataListOpen,
                            alreadySchedulingNum: objectOP.objectMap.orderWeight,
                            lastDeliveryTime: objectOP.objectMap.orderDeliveryDate,
                            planSchedulId: objectOP.objectMap.id,
                            weavDeliveryDate: objectOP.objectMap.orderDeliveryDate,
                            calculateData: []
                        },
                    }).then(({ data, code, message }) => {
                        if (code === 200) {
                            pageData.changeList = data
                            // pageData.onlyTotal = data.forEach(item => {
                            //     pageData.onlyTotal += item.alreadyWeight
                            // })
                            pageData.onlyTotal = data.reduce((accumulator, current) => {
                                return accumulator + current.alreadyWeight;
                            }, 0);

                        } else {
                            Message.error({
                                content: message,
                                duration: 5000,
                            })

                        }
                    })
                } else {
                    Message.error({
                        content: message,
                        duration: 5000,
                    })
                }
            })

        } else {
            Message.error({
                content: message,
                duration: 5000,
            })
        }
    })
}
// 排产确定按钮事件
const save = () => {
    objectOP.BCoption = true
    // let t1 = document.querySelector("#startDate1").value; //开始日期
    // let t2 = document.querySelector("#endDate1").value; //结束日期
    post({
        // url: 'planSingle/planSchedul/getScheduleSave',
        url: 'planSingle/planSchedul/getScheduleByDay',
        // data: {
        //     ...objectOP.objectMap,
        //     alreadySchedulingNum: objectOP.objectMap.orderWeight,
        //     lastDeliveryTime: objectOP.objectMap.orderDeliveryDate,
        //     planSchedulId: objectOP.objectMap.id,
        //     weavDeliveryDate: objectOP.objectMap.orderDeliveryDate,
        //     save: pageData.changeList,
        //     after: []
        // },
        data: pageData.changeList
    }).then(({ data, code, message }) => {
        if (code === 200) {
            // console.log(data);
            // pageData.changeList = data
            let t1 = data.startTime.split(" ")[0]
            let t2 = data.endTime.split(" ")[0]
            document.querySelector("#startDate1").value = t1 //开始日期
            document.querySelector("#endDate1").value = t2 //结束日期
            objectOP.payItem = pageData.option
            // dataInfoList(t1, t2, data.list)
            Message.success({
                content: message,
                duration: 5000,
            })
            dateInfo(t1, t2, data.list)
            objectOP.JToption = true
            pageData.dataInfo = data.list
            objectOP.dialogFormVisible = false
            pageData.changeList = []
            pageData.option = ''
        } else {
            Message.error({
                content: message,
                duration: 5000,
            })
        }
    })
    objectOP.dialogFormVisible = false
}
const saOut = () => {
    objectOP.dialogFormVisible = false
    pageData.changeList = []
    pageData.option = ''
}
const saveOpen1 = () => {
    objectOP.dialogFormVules1 = false
    pageData.taskList2 = []
    objectOP.divList = []
}
// 合并任务保存事件
const saveOpen = (val) => {
    let t1 = document.querySelector("#startDate1").value; //开始日期
    let t2 = document.querySelector("#endDate1").value; //结束日期
    // console.log(objectOP.divList, '这个合并是不是想造反');

    if (val === 2) {
        objectOP.dayN2 = dayjs(objectOP.dayN2).format('YYYY-MM-DD')
        let obeeterPick = []
        objectOP.divList = multipleSelection.value
        pageData.dataInfo.forEach(item => {
            if (item.name == objectOP.option2) {
                item.data.forEach(shem => {
                    if (new Date(shem.date) == new Date(objectOP.dayN2)) {
                        obeeterPick.push(shem.data)
                    }
                })
            }
        })
        // console.log(new Date(objectOP.dayN2), '这个合并是不是想造反2');
        if (obeeterPick.length === 0) {
            objectOP.divList.forEach(item => {
                item.machineCode = objectOP.machineCode;
                item.newMachineCode = objectOP.option2;
                item.day = objectOP.date;
                item.dayN = objectOP.dayN2 + item.time1;
                item.state = 0
                item.time1 = item.time1.trim()
                item.time2 = item.time2.trim()
            })
        } else {

            objectOP.divList.forEach(item => {
                if (stadey) {
                    item.state = 1
                } else {
                    item.state = 0
                }
                item.machineCode = objectOP.machineCode;
                item.newMachineCode = objectOP.option2;
                item.day = objectOP.date;
                item.dayN = objectOP.dayN2 + item.time1;
                item.state = 1
                item.time1 = item.time1.trim()
                item.time2 = item.time2.trim()
            })
        }
        pageData.newList = pageData.dataInfo.filter(item => {
            if (item.name == objectOP.option2) {
                return item.data
            }
        })
        // console.log(pageData.newList);
        pageData.oldList = pageData.dataInfo.filter(item => {
            if (item.name == objectOP.machineCode) {
                return item.data
            }
        })
    } else {
        if (objectOP.taskName1 == '' || objectOP.taskName1 == null || objectOP.taskName1 == undefined) {
            // 拖动的单个数据的集合=>objectOP.divList
            objectOP.divList.forEach(item => {
                item.machineCode = objectOP.jt;
                item.newMachineCode = objectOP.jt1;
                item.day = objectOP.date;
                item.dayN = objectOP.date1 + item.time1;
                item.state = 0
                item.time1 = item.time1.trim()
                item.time2 = item.time2.trim()
            })
        } else {
            let stadey = true
            stadey = pageData.taskList1.every(val => {
                return val.productionState < 2
            })
            objectOP.divList.forEach(item => {
                if (stadey) {
                    item.state = 1
                } else {
                    item.state = 0
                }
                item.machineCode = objectOP.jt;
                item.newMachineCode = objectOP.jt1;
                item.day = objectOP.date;
                item.dayN = objectOP.date1 + item.time1;
                // item.state = 1
                item.time1 = item.time1.trim()
                item.time2 = item.time2.trim()
            })
        }
        pageData.newList = pageData.dataInfo.filter(item => {
            if (item.name == objectOP.jt1) {
                return item.data
            }
        })
        pageData.oldList = pageData.dataInfo.filter(item => {
            if (item.name == objectOP.jt) {
                return item.data
            }
        })
    }

    // post({
    //     url: 'planSingle/planSchedul/gUpdatePMT',
    //     data: objectOP.divList
    // }).then(({ data, code, message }) => {
    //     if (code === 200) {
    let stadey = false
    stadey = pageData.dataInfo.every(item => {
        return item.name != objectOP.option2
    })
    if (stadey) {
        objectOP.option5.push(objectOP.option2)
        saveOpen5()
    }
    post({
        url: 'planSingle/planSchedul/gUpdatePMT2',
        data: {
            now: objectOP.divList,
            old: pageData.oldList[0].data,
            new: pageData.newList.length === 0 ? [] : pageData.newList[0].data
        }
    }).then(({ data, code, message }) => {
        if (code === 200) {
            data.forEach(function (o) {
                pageData.dataInfo.forEach(function (o1) {
                    if (o['name'] == o1['name']) {
                        o1['data'] = o['data']
                    }
                })
            })
            objectOP.BCoption = true
            dateInfo(t1, t2, pageData.dataInfo)
            objectOP.dialogFormVules = false
            pageData.taskList = []
            objectOP.divList = []
            objectOP.dialogFormVules3 = false
            objectOP.dayN2 = ''
            objectOP.option2 = ''
            pageData.taskList2 = []
        } else {
            Message.error({
                content: message,
                duration: 5000,
            })
        }
    })
    // } else {
    //     Message.error({
    //         content: message,
    //         duration: 5000,
    //     })
    // }
    // })
}

const rules = reactive({
    option2: [
        { required: true, message: '请输入机台号', trigger: 'blur' },
        { required: true, message: '请输入机台号', trigger: 'change' },
    ],
    dayN2: [
        { required: true, message: '请填写排产日期', trigger: 'blur' },
        { required: true, message: '请填写排产日期', trigger: 'change' },
    ],
    option4: [
        { required: true, message: '请输入机台号', trigger: 'blur' },
        { required: true, message: '请输入机台号', trigger: 'change' },
    ],
    dayN4: [
        { required: true, message: '请填写排产日期', trigger: 'blur' },
        { required: true, message: '请填写排产日期', trigger: 'change' },
    ],
})

const saveOpen2 = () => {
    let t1 = document.querySelector("#startDate1").value; //开始日期
    let t2 = document.querySelector("#endDate1").value; //结束日期
    ruleFormRef.value.validate((valid, fields) => {
        if (valid) {
            objectOP.dayN2 = dayjs(objectOP.dayN2).format('YYYY-MM-DD HH:mm:ss')
            post({
                url: "planSingle/planSchedul/gUpdatePMTByOrder",
                data: {
                    machineCode: objectOP.machineCode,
                    planOrderCode: objectOP.planOrderCode,
                    num: objectOP.num2,
                    dayN: objectOP.dayN2,
                    newMachineCode: objectOP.option2
                }
            }).then(({ data, code, message }) => {
                if (code === 200) {
                    data.forEach(function (o) {
                        pageData.dataInfo.forEach(function (o1) {
                            if (o['name'] == o1['name']) {
                                o1['data'] = o['data']
                            }
                        })
                    })
                    dateInfo(t1, t2, pageData.dataInfo)
                    objectOP.dialogFormVules3 = false
                    objectOP.dayN2 = ''
                    objectOP.option2 = ''
                    pageData.taskList2 = []
                } else {
                    Message.error({
                        content: message,
                        duration: 5000,
                    });
                }
            });
        }
    })
}
const saveOpen4 = () => {
    let t1 = document.querySelector("#startDate1").value; //开始日期
    let t2 = document.querySelector("#endDate1").value; //结束日期
    ruleFormRef.value.validate((valid, fields) => {
        if (valid) {
            objectOP.dayN4 = dayjs(objectOP.dayN4).format('YYYY-MM-DD HH:mm:ss')
            let stadey = false
            stadey = pageData.dataInfo.every(item => {
                return item.name != objectOP.option4
            })
            if (stadey) {
                objectOP.option5.push(objectOP.option4)
                saveOpen5()
            }
            post({
                url: "planSingle/planSchedul/gSplitDayPMT",
                data: {
                    machineCode: objectOP.machineCode,
                    planOrderCode: objectOP.planOrderCode,
                    num: objectOP.CfWeight,
                    dayN: objectOP.dayN4,
                    newMachineCode: objectOP.option4,
                    day: objectOP.date
                }
            }).then(({ data, code, message }) => {
                if (code === 200) {
                    data.forEach(function (o) {
                        pageData.dataInfo.forEach(function (o1) {
                            if (o['name'] == o1['name']) {
                                o1['data'] = o['data']
                            }
                        })
                    })
                    dateInfo(t1, t2, pageData.dataInfo)
                    objectOP.BCoption = true
                    objectOP.dialogFormVules4 = false
                    objectOP.dayN4 = ''
                    objectOP.option4 = ''
                    objectOP.CfWeight = ''
                } else {
                    Message.error({
                        content: message,
                        duration: 5000,
                    });
                }
            });
        }
    })
}
const saveOpen5 = () => {
    let t1 = document.querySelector("#startDate1").value; //开始日期
    let t2 = document.querySelector("#endDate1").value; //结束日期
    if (objectOP.option5 == '' || objectOP.option5 == null || objectOP.option5 == undefined) {
        objectOP.option5 = []
        objectOP.dialogFormVules5 = false
    } else {
        document.querySelector("#startDate1").value = t1
        document.querySelector("#endDate1").value = t2
        post({
            url: 'planSingle/planSchedul/getScheduleInfoByDayG',
            data: {
                startTime: t1 + " 00:00:00",
                endTime: t2 + " 23:59:59",
                machines: objectOP.option5,
                addMachines: pageData.dataInfo,
            },
        }).then(({ data, code, message }) => {
            if (code === 200) {
                pageData.dataInfo = data
                dateInfo(t1, t2, pageData.dataInfo)
                objectOP.option5 = []
                objectOP.dialogFormVules5 = false
            } else {
                Message.error({
                    content: message,
                    duration: 5000,
                })
            }
        })

    }
}
const saveOut = () => {
    objectOP.dialogFormVules = false
    pageData.taskList = []
    objectOP.divList = []
}
const saveOut1 = () => {
    objectOP.dialogFormVules1 = false
    pageData.taskList2 = []
    objectOP.divList = []
}
const saveOut2 = () => {
    objectOP.dialogFormVules3 = false
    pageData.taskList3 = []
}
const saveOut4 = () => {
    objectOP.dialogFormVules4 = false
}
const saveOut5 = () => {
    objectOP.option5 = []
    objectOP.dialogFormVules5 = false
}
const saveOut6 = () => {
    objectOP.dialogFormVules6 = false
}
const saveOpen6 = () => {
    saveOpen(1)
    objectOP.dialogFormVules6 = false
}

//const dateInfoList = ref([])
const dataInfoList1 = () => {
    let t1 = document.querySelector("#startDate1").value; //开始日期
    let t2 = document.querySelector("#endDate1").value; //结束日期
    let v3 = objectOP.payItem
    let v4 = objectOP.planOrderCodes
    objectOP.BCoption = false
    objectOP.JToption = false
    dataInfoList(t1, t2, v3, v4)
}
// 机台工作明细查询事件
const dataInfoList = (t1, t2, val, v4) => {
    // console.log(document.querySelector("#startDate1").value = t1, '888888888888');
    // let dataInfo = [] 
    document.querySelector("#startDate1").value = t1
    document.querySelector("#endDate1").value = t2
    post({
        url: 'planSingle/planSchedul/getScheduleInfoByDayG',
        data: {
            startTime: t1 + " 00:00:00",
            endTime: t2 + " 23:59:59",
            machines: val,
            planOrderCodes: v4
        },
    }).then(({ data, code, message }) => {
        if (code === 200) {
            pageData.dataInfo = data
            dateInfo(t1, t2, pageData.dataInfo)
            // dateInfo(t1, t2)
        } else {
            Message.error({
                content: message,
                duration: 5000,
            })
        }
    })
}

// 合并任务勾选事件
const getItemStatus = (val, item) => {
    if (val) {
        objectOP.divList.push(item)
    } else {
        objectOP.divList = objectOP.divList.filter(o => {
            return o.id != item.id
        })
    }
    // console.log(objectOP.divList, '这个合并咋回事啊');
}
// 整单按钮
const ZDclick = () => {
    objectOP.dialogFormVules2 = false
    if (objectOP.planOrderCode != '' && objectOP.planOrderCode != null && objectOP.planOrderCode != undefined) {
        let HangList = []
        let HangList1 = []
        pageData.dataInfo.filter(item => {
            if (item.name == objectOP.machineCode) {
                HangList = item.data
            }
        })
        HangList.filter(item => {
            item.data.filter(o => {
                if (o.planOrderCode == objectOP.planOrderCode) {
                    HangList1.push(o)
                }
            })
        })
        pageData.taskList3 = HangList1
        // console.log(pageData.taskList3)
        objectOP.dialogFormVules3 = true
        objectOP.dayN2 = ''
        objectOP.option2 = ''
        toggleSelection(pageData.taskList3)
        // console.log(HangList, HangList1);
        // post({
        //     url: 'planSingle/planMachineTaskDay/getDayPMT',
        //     data: {
        //         machineCode: objectOP.machineCode,
        //         planOrderCode: objectOP.planOrderCode
        //     },
        // }).then(({ data, code, message }) => {
        //     if (code === 200) {
        //         console.log(data, pageData.dataInfo)
        //         pageData.taskList3 = data
        //         objectOP.dialogFormVules3 = true
        //         objectOP.dayN2 = ''
        //         objectOP.option2 = ''
        //         toggleSelection(pageData.taskList3)
        //     } else {
        //         Message.error({
        //             content: message,
        //             duration: 5000,
        //         })
        //     }
        // })
    }

    // console.log(pageData.taskList3, '2');
}
const objectOPmouseleave = () => {
    objectOP.dialogFormVules2 = false
}
// 拆分按钮
const CFclick = () => {
    objectOP.dialogFormVules2 = false
    // post({
    //     url: 'planSingle/planMachineTask/getList',
    //     data: {
    //         machineCode: objectOP.machineCode,
    //         planOrderCode: objectOP.planOrderCode
    //     },
    // }).then(({ data, code, message }) => {
    //     if (code === 200) {
    //         objectOP.YyWeight = data[0].alreadyWeight
    if (objectOP.planOrderCode != '' && objectOP.planOrderCode != null && objectOP.planOrderCode != undefined) {
        if (objectOP.productionState >= 2) {
            Message.error({
                content: "已完结的任务无法进行拆分！",
                duration: 5000,
            })
        } else {
            objectOP.dialogFormVules4 = true
        }
        objectOP.dayN4 = ''
        objectOP.option4 = ''
        objectOP.CfWeight = ''
    }

    //     } else {
    //         Message.error({
    //             content: message,
    //             duration: 5000,
    //         })
    //     }
    // })
}
const isRowSelectable = (row) => {
    return row.productionState < 2
}
// 默认全选事件
const toggleSelection = (rows) => {
    if (rows) {
        nextTick(() => {
            rows.forEach((row) => {
                // console.log(row)
                if (row.productionState < 2) {
                    multipleTableRef.value.toggleRowSelection(row, undefined)
                }
            })
        })
    } else {
        multipleTableRef.value.clearSelection()
    }
}
const handleSelectionChange = (val) => {
    multipleSelection.value = val
    // console.log(val, '风萧萧兮易水寒');
    objectOP.num2 = 0
    val.forEach((item) => {
        objectOP.num2 += Number(item.scheduleWeight);
    });
    // console.log(objectOP.num2, '风萧萧兮易水寒');
}
const focusShelve5 = () => {
    post({
        url: "planSingle/planOrder/getDropInfo",
        data: { "planOrderCode": "" }
    }).then(({ data, code }) => {
        if (code === 200) {
            pageData.ZBoptions = data;
        } else {
            Message.error({
                content: "查询失败！",
                duration: 5000,
            });
        }
    });
}
// const focusShelve5 = () => {
//     selCxAllopen5({ "planOrderCode": "" });
// }
// const optionsopen5 = ref(pageData.ZBoptions);
// const loadingopen5 = ref(false);
// const handleSearchopen5 = (value) => {
//     if (value) {
//         const ob = { planOrderCode: value, deleteState: 0 }
//         loadingopen5.value = true;
//         selCxAllopen5(ob);
//         optionsopen5.value = pageData.ZBoptions;
//         loadingopen5.value = false;
//     } else {
//         optionsopen5.value = []
//     }
// };
// function selCxAllopen5(val) {
//     post({
//         url: "planSingle/planOrder/getDropInfo",
//         data: val
//     }).then(({ data, code }) => {
//         if (code === 200) {
//             pageData.ZBoptions = data;
//         } else {
//             Message.error({
//                 content: "查询失败！",
//                 duration: 5000,
//             });
//         }
//     });
// }
// 保存接口
const dataInfoListBC = () => {
    // console.log(pageData.dataInfo)
    let obList = []
    // for (let obj of pageData.dataInfo) {
    //     for (let item of obj.data) {
    //         obList = obList.concat(item.data);
    //     }
    // }
    // objectOP.taskName = objectOP.taskName.split(":")[0]
    // if (obList == '' || obList == null || obList == undefined) {
    //     Message.error({
    //         content: "未排产数据无法保存！",
    //         duration: 5000,
    //     });
    //     return
    // }
    // if (!objectOP.JToption) {
    //     Message.error({
    //         content: "未排产数据无法保存！",
    //         duration: 5000,
    //     });
    //     return
    // }
    post({
        url: "planSingle/planSchedul/getScheduleSaveG",
        data: {
            planOrderCode: objectOP.taskName,
            // save: obList
            save: pageData.dataInfo
        }
    }).then(({ data, code, message }) => {
        if (code === 200) {
            Message.success({
                content: "保存成功！",
                duration: 5000,
            })
            dataInfoList1()
            objectOP.JToption = false
            objectOP.BCoption = false
        } else {
            Message.error({
                content: message,
                duration: 5000,
            });
        }
    });
}
const dataInfoListaJT = () => {
    objectOP.dialogFormVules5 = true
}
const BlurMap = () => {
    dataInfoList1()
    objectOP.JToption = false
    objectOP.BCoption = false
}
const dateInfo = function (t1, t2, dataInfo) {
    //假数据：后期后台传值格式，任务除了这些主要字段外，可随意加上来
    // let dataInfo = [
    //     {
    //         "name": "机台1",
    //         "data": [
    //             {
    //                 "date": "2023-06-01", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务1", "id": "1", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务2", "id": "2", "num": "200", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-03", "data": [
    //                     { "time1": "09:10", "time2": "23:10", "name": "任务3", "id": "3", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-05", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务4", "id": "4", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务5", "id": "5", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-07", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务6", "id": "6", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务7", "id": "7", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-09", "data": [
    //                     { "time1": "09:10", "time2": "23:59", "name": "任务8", "id": "8", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-10", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务8", "id": "9", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务9", "id": "10", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-11", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务10", "id": "11", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务11", "id": "12", "num": "100", "yNum": "100" }
    //                 ]
    //             }
    //         ]
    //     },
    //     {
    //         "name": "机台2",
    //         "data": [
    //             {
    //                 "date": "2023-06-01", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务1", "id": "13", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务2", "id": "14", "num": "200", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-02", "data": [
    //                     { "time1": "09:10", "time2": "23:10", "name": "任务3", "id": "15", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-03", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务4", "id": "16", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务5", "id": "17", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-04", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务6", "id": "18", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务7", "id": "19", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-05", "data": [
    //                     { "time1": "09:10", "time2": "23:59", "name": "任务8", "id": "20", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-06", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务8", "id": "21", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务9", "id": "22", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-07", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务10", "id": "23", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务11", "id": "24", "num": "100", "yNum": "100" }
    //                 ]
    //             }
    //         ]
    //     },
    //     {
    //         "name": "机台3",
    //         "data": [
    //             {
    //                 "date": "2023-06-01", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务1", "id": "25", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务2", "id": "26", "num": "200", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-02", "data": [
    //                     { "time1": "09:10", "time2": "23:10", "name": "任务3", "id": "27", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-03", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务4", "id": "28", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务5", "id": "29", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-04", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务6", "id": "30", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务7", "id": "31", "num": "200", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-05", "data": [
    //                     { "time1": "09:10", "time2": "23:59", "name": "任务8", "id": "32", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-06", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务8", "id": "33", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务9", "id": "34", "num": "100", "yNum": "100" }
    //                 ]
    //             },
    //             {
    //                 "date": "2023-06-07", "data": [
    //                     { "time1": "09:10", "time2": "15:10", "name": "任务10", "id": "35", "num": "100", "yNum": "100" },
    //                     { "time1": "14:10", "time2": "23:10", "name": "任务11", "id": "36", "num": "100", "yNum": "100" }
    //                 ]
    //             }
    //         ]
    //     },

    // ];

    //如果只是查询取开始和结束日期展示；但如果是试算，直接取试出来的日期段；明天写一个试算按钮，传入假数据进这个方法再取日期：

    //计算日期：
    const diffTime = Math.abs(new Date(t1) - new Date(t2));
    const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
    const daysList = [];
    for (let i = 0; i <= diffDays; i++) {
        const day = new Date(t1);
        day.setDate(day.getDate() + i);
        const vYear = day.getFullYear();
        const vMon = day.getMonth() + 1;
        const vDay = day.getDate();
        const stime = vYear + "-" + (vMon < 10 ? "0" + vMon : vMon) + "-" + (vDay < 10 ? "0" + vDay : vDay);
        daysList.push(stime);
    }
    //dateInfoList.value = daysList;
    // $(".gantt-chart").width(daysList.length * 200);
    // document.querySelectorAll('.gantt-chart').forEach(function (element) {
    //   element.style.width = daysList.length * 200 + 'px';
    // });

    //计算右边框div的上边距和左边距值，把它给到遮层定位
    const rightDiv = document.getElementById('right');
    const rect = rightDiv.getBoundingClientRect();
    const top = rect.top + window.scrollY;
    const left = rect.left + window.scrollX;

    var ganttChart = document.querySelector('.gantt-chart');
    if (ganttChart !== null) {
        ganttChart.style.width = daysList.length * 200 + 'px';
    }
    if (daysList.length > 0) {
        //表头第一个格子
        const div = document.querySelector('.gantt-chart');
        div.innerHTML = '';
        div.style.gridTemplateColumns = "100px " + "repeat(" + daysList.length + ", 1fr)";
        const tr = document.createElement('div');
        tr.className = 'gantt-chart-header';
        tr.innerText = "";
        tr.style.display = 'inline-block';
        tr.style.width = '100px'
        div.appendChild(tr);


        //左上角遮层：
        const tr1 = document.createElement('div');
        tr1.className = 'gantt-chart-zc';
        tr1.innerText = "";
        tr1.style.display = 'inline-block';
        tr1.style.width = '100px';
        tr1.style.top = top + 'px';
        // tr1.style.left = left + 'px';
        tr1.style.background = '#f1f1f1';
        tr1.style.position = 'fixed';
        tr1.style.height = '50px';
        tr1.style.lineHeight = '50px';
        tr1.style.whiteSpace = 'nowrap';
        tr1.style.zIndex = '999';
        div.appendChild(tr1);

        //表头其他例
        for (let i = 0; i < daysList.length; i++) {
            const tr = document.createElement('div');
            tr.className = 'gantt-chart-header';
            tr.innerText = daysList[i];
            tr.style.display = 'inline-block';
            div.appendChild(tr);
        }
        //封装div标签
        if (dataInfo.length > 0) {
            for (let j = 0; j < dataInfo.length; j++) {
                const div = document.querySelector('.gantt-chart');
                div.style.gridTemplateColumns = "100px " + "repeat(" + daysList.length + ", 1fr)";
                const tr = document.createElement('div');
                tr.className = 'gantt-chart-header-left';
                //机台名称
                tr.innerText = dataInfo[j].name;
                tr.style.display = 'inline-block';
                div.appendChild(tr);
                for (let i = 0; i < daysList.length; i++) {

                    //第一行的机台信息
                    const ob = dataInfo[j];
                    //找出任务是否为空或不为空
                    let taskList = [];
                    for (let k = 0; k < ob.data.length; k++) {

                        //找到对应日期，找不到一直找完，找到了跳出，然后读取数据
                        if (ob.data[k].date === daysList[i]) {
                            taskList = ob.data[k].data;
                            break;
                        }
                    }
                    //没有任务的数据
                    if (taskList.length == 0) {
                        const tr = document.createElement('div');
                        tr.className = 'gantt-chart-item';
                        tr.innerText = "";
                        //显示的内容
                        tr.setAttribute('data-title', "");
                        //日期
                        tr.setAttribute('data-date', daysList[i]);
                        //机台名称
                        tr.setAttribute('data-name', ob.name);
                        //任务数据
                        tr.setAttribute('data-info', JSON.stringify([]));
                        tr.display = 'inline-block';
                        tr.draggable = true;
                        const tr1 = document.createElement('div');
                        tr1.className = 'task-progress';
                        tr1.innerText = "";
                        tr1.style.display = 'inline-block';
                        tr1.style.width = '100%';
                        tr1.style.background = 'grey'
                        tr.appendChild(tr1);
                        div.appendChild(tr);
                    } else {
                        const tr = document.createElement('div');
                        tr.className = 'gantt-chart-item';
                        //取出任务名称，多个用/隔开
                        let str = "";
                        let taskZt = 0;
                        for (let x = 0; x < taskList.length; x++) {

                            switch (str) {
                                case "":
                                    str = taskList[x].name + ":" + taskList[x].num;
                                    break;
                                default:
                                    str += "/" + taskList[x].name + ":" + taskList[x].num;
                                    break;
                            }

                            //当此天此台机任务完成状态为完成时，检查是否有未完成的任务              
                            if (taskZt == 0) {
                                if (parseFloat(taskList[x].num) > parseFloat(taskList[x].yNum)) {
                                    taskZt = 1;
                                }
                            }
                        }


                        tr.innerText = "";
                        //显示的内容
                        tr.setAttribute('data-title', str);
                        //日期
                        tr.setAttribute('data-date', daysList[i]);
                        //机台名称
                        tr.setAttribute('data-name', ob.name);
                        //任务数据
                        tr.setAttribute('data-info', JSON.stringify(taskList));
                        tr.display = 'inline-block';
                        if (taskList[0].productionState >= 2) {
                            tr.draggable = false;
                            const tr1 = document.createElement('div');
                            tr1.className = 'task-progress';
                            tr1.innerText = str;
                            tr1.style.display = 'inline-block';
                            tr1.style.width = '100%';
                            tr1.style.background = 'yellow';

                            setTitleInfo(tr1, JSON.stringify(taskList));
                            tr.appendChild(tr1);
                            div.appendChild(tr);
                        } else {
                            tr.draggable = true;
                            const tr1 = document.createElement('div');
                            tr1.className = 'task-progress';
                            tr1.innerText = str;
                            tr1.style.display = 'inline-block';
                            tr1.style.width = '100%';
                            //如果完成状态：已完成显示绿色，未完成显示桔色
                            if (taskZt > 0) {
                                tr1.style.background = 'orange';
                            } else {
                                tr1.style.background = 'green';
                            }

                            setTitleInfo(tr1, JSON.stringify(taskList));
                            tr.appendChild(tr1);
                            div.appendChild(tr);
                        }



                    }
                }
            }
        }
    }
    //左边div的拖动与右边的冲突，有时间解决
    // const dragElements = document.querySelectorAll(".drag");
    // const dropElement = document.querySelector(".right");
    // dragElements.forEach(dragElement => {
    //   dragElement.addEventListener("dragstart", function (event) {
    //     //标签中的值
    //     const narValue = event.target.getAttribute("data-info");
    //     //标签中的文本
    //     const text=event.target.textContent;
    //     //传data-info中的值
    //     event.dataTransfer.setData("text/plain",narValue);
    //   });
    // });
    // dropElement.addEventListener("dragover", function (event) {
    //   event.preventDefault();
    // });
    // dropElement.addEventListener("drop", function (event) {
    //   event.preventDefault();
    //   const droppedText = event.dataTransfer.getData("text/plain");
    //   //文本内容展示
    //   alert("文本内容展示:"+droppedText);
    // });




    const taskItems = document.querySelectorAll('.gantt-chart-item');
    taskItems.forEach(item => {
        item.addEventListener('dragstart', event => {
            // const text = item.querySelector("div").textContent;
            // const text = item.querySelectorAll(".task-progress")[0].textContent;
            const taskName = item.getAttribute("data-title");
            const date = item.getAttribute("data-date");
            const task = item.getAttribute("data-info");
            const jt = item.getAttribute("data-name");
            const list = [];
            //日期
            list.push(date);
            //任务合并的名称
            list.push(taskName);
            //机台
            list.push(jt);
            //任务详情况json
            list.push(task);
            // const taskList = JSON.parse(task);
            // if (taskList[0].productionState >= 2) {
            //     item.classList.add('draggingII');
            // } else {
            // item.classList.add('dragging');
            // }
            event.dataTransfer.setData('text/plain', JSON.stringify(list));
            item.classList.add('dragging');
            objectOP.dialogFormVules2 = false
        });
        item.addEventListener('click', event => {
            objectOP.dialogFormVules2 = false
        });
        item.addEventListener('contextmenu', function (event) {
            event.preventDefault();
            const taskName = item.getAttribute("data-title");
            const jt = item.getAttribute("data-name");
            const date = item.getAttribute("data-date");
            const task = item.getAttribute("data-info");
            objectOP.machineCode = jt
            const taskN = taskName.split(":")[0]
            objectOP.YyWeight = Number(taskName.split(":")[1])
            objectOP.planOrderCode = taskN
            objectOP.date = date
            const taskList = JSON.parse(task);
            objectOP.productionState = taskList[0].productionState
            // 拿到相同任务号的所有块级数据
            // let JTList = []
            // pageData.dataInfo.forEach(item => {
            //     if (item.name == jt) {
            //         item.data.forEach(function (item1) {
            //             item1.data.forEach(function (item2) {
            //                 if (item2.name == taskN) {
            //                     JTList.push(item2)
            //                 }
            //             })
            //         })
            //     }
            // })
            // console.log(JTList, '哦哦哦哈哈哈');
            // pageData.taskList2 = JTList
            pageData.contextMenuPosition = { left: event.clientX, top: event.clientY }
            // console.log(pageData.contextMenuPosition, '哦哦哦哈哈哈');
            objectOP.dialogFormVules2 = true
        })
    });

    // 获取所有甘特图单元格
    const cells = document.querySelectorAll('.gantt-chart-item');
    // 为每个单元格添加事件侦听器
    cells.forEach(cell => {
        // 当拖动的项目位于单元格上方时
        cell.addEventListener('dragover', event => {
            event.preventDefault();
        });
        // 将拖动的项目放到单元格上时
        cell.addEventListener('drop', event => {
            // 获取被拖动的数据
            const data = JSON.parse(event.dataTransfer.getData('text/plain'));
            //日期
            const date = data[0];
            //任务合并的名称
            const taskName = data[1];
            //机台
            const jt = data[2];
            //任务详情JSON
            const task = data[3];
            const taskList = JSON.parse(task);
            // 排产周期时间
            const wevertDate = taskList[0].weavDeliveryDate
            //任务合并的名称
            const taskName1 = cell.getAttribute("data-title");
            //日期
            const date1 = cell.getAttribute("data-date");
            //机台
            const jt1 = cell.getAttribute("data-name");
            //任务详情JSON
            const task1 = cell.getAttribute("data-info");
            const taskList1 = JSON.parse(task1);
            if (taskName == "") {
                // alert("无任务不可排产");
                Message.error({
                    content: "无任务不可排产",
                    duration: 5000,
                });
            } else if (date.trim() !== date1.trim() || taskName.trim() !== taskName1.trim() || jt.trim() !== jt1.trim()) {
                pageData.taskList = taskList
                pageData.taskList1 = taskList1
                objectOP.data = data
                objectOP.date = date
                objectOP.taskName = taskName
                objectOP.jt = jt
                objectOP.taskName1 = taskName1
                objectOP.date1 = date1
                objectOP.jt1 = jt1
                objectOP.registerDate = dayjs().format('YYYY-MM-DD')
                // console.log(objectOP.date, objectOP.date1 = date1, '看看这两个的时间');
                // let data = '2022-02-02'
                let time = Date.parse(objectOP.date)
                let time1 = Date.parse(objectOP.registerDate)
                let time2 = Date.parse(objectOP.date1)
                if (time2 >= time1 && time >= time1) {
                    if (taskList.length == 1) {
                        if (Date.parse(wevertDate) > Date.parse(date1)) {
                            objectOP.divList = taskList
                            objectOP.BCoption = true
                            saveOpen(1)
                        } else {
                            objectOP.BCoption = true
                            objectOP.divList = taskList
                            objectOP.dialogFormVules6 = true
                        }
                    } else {
                        objectOP.BCoption = true
                        objectOP.dialogFormVules = true
                    }
                } else {
                    Message.error({
                        content: "请勿将排产时间定在过去！",
                        duration: 5000,
                    });
                }


                // alert(task);
                // alert("请求后端重新计算值不相同，请求后端去操作！需改变机台或时间的任务：日期：" + date + "，机台:" + jt + "，任务名称:" + taskName + "，任务详情：" + task + "；要往后移的任务：日期：" + date1 + "，机台：" + jt1 + "，任务名称：" + taskName1 + "任务详情：" + task1);
            } else {
                // alert("相同任务没有改变任何值：比如机台或时间，不进行任何操作！");
                Message.error({
                    content: "相同任务没有改变任何值：比如机台或时间，不进行任何操作！",
                    duration: 5000,
                });
            }

        });
    });

}
const startDate1 = ref(dayjs().format('YYYY-MM-DD'))
const endDate1 = ref(dayjs((Date.parse(dayjs().format('YYYY-MM-DD')) / 1000 + 604800) * 1000).format('YYYY-MM-DD'))
const pickerOptions = reactive(
    {
        disabledDate(time) {
            return time.getTime() > Date.now();
        },
        shortcuts: [{
            text: '今天',
            onClick(picker) {
                picker.$emit('pick', new Date());
            }
        }, {
            text: '昨天',
            onClick(picker) {
                const date = new Date();
                date.setTime(date.getTime() - 3600 * 1000 * 24);
                picker.$emit('pick', date);
            }
        }, {
            text: '一周前',
            onClick(picker) {
                const date = new Date();
                date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
                picker.$emit('pick', date);
            }
        }]
    }
)

//页面自动计算
function innerH() {
    let w = window.innerWidth;
    document.querySelector(".right").style.width = w + 200 + "px";
    let h = window.innerHeight;
    document.querySelector(".left").style.height = h - 210 + "px";
    document.querySelector(".right").style.height = h - 210 + "px";
}
//数据比较是否相同
function arrayIsEqual(arr1, arr2) {
    if (!arr1 || !arr2) {
        return false;
    }
    if (arr1.length !== arr2.length) {
        return false;
    }
    for (var i = 0; i < arr1.length; i++) {
        if (arr1[i] instanceof Array && arr2[i] instanceof Array) {
            if (!arr1[i].equals(arr2[i]))
                return false;
        } else if (arr1[i] !== arr2[i]) {
            return false;
        }
    }
    return true;
}
//title自定义(对象，json对象格式化的:JSON.stringify())
function setTitleInfo(ob, newtitle) {
    let x = 10;
    let y = 20;
    //转成Json
    const newtitleJson = JSON.parse(newtitle);
    //取值：一个任务为一个对象，多个则是多个（time1为开始时间，time2为结束时间，name为任务名称，id对应后端，num 生产数量，其他字段后端可以自定义，现暂时为几这个关键字段）；样式为：
    //           [ 
    //              { "time1": "09:10", "time2": "15:10", "name": "任务8", "id": "33", "num": "100","yNum":"50" },
    //              { "time1": "14:10", "time2": "23:10", "name": "任务9", "id": "34", "num": "100" ,"yNum":"100"}
    //           ]
    let h = '';
    if (newtitleJson.length > 0) {
        for (let i = 0; i < newtitleJson.length; i++) {
            let taskName = "任务名称：" + newtitleJson[i].name;
            let t1 = "开始时间：" + newtitleJson[i].time1;
            let t2 = "结束时间：" + newtitleJson[i].time2;
            let num = "任务数量：" + newtitleJson[i].num + "KG";
            let yNum = "完成数量：" + newtitleJson[i].yNum + "KG";
            let wNum;
            if (parseFloat(newtitleJson[i].num) > 0 && parseFloat(newtitleJson[i].yNum) > 0) {
                let bl = parseFloat(parseFloat(newtitleJson[i].yNum) * 100 / parseFloat(newtitleJson[i].num)).toFixed(2);
                wNum = "完成比例：" + bl + "%";
            } else {
                wNum = "完成比例：0%";
            }
            if (i > 0) {
                h += '<hr style="width:100%"/>';
            }
            h += '<div>' + taskName + '</div>';
            h += '<div>' + t1 + '</div>';
            h += '<div>' + t2 + '</div>';
            h += '<div>' + num + '</div>';
            h += '<div>' + yNum + '</div>';
            h += '<div>' + wNum + '</div>';
        }
    }

    ob.addEventListener('mouseover', function (e) {
        let mytitle = document.createElement('div');
        mytitle.setAttribute('id', 'mytitle');
        mytitle.innerHTML = h;
        document.body.appendChild(mytitle);
        mytitle.style.left = (e.pageX - x - 150) + 'px';
        mytitle.style.top = (e.pageY + y - 80) + 'px';
        mytitle.style.display = 'block';
        mytitle.style.width = '150px';
        mytitle.style.height = 'auto';
        mytitle.style.position = 'absolute';
        mytitle.style.color = '#ffffff';
        mytitle.style.font = '14px';
        mytitle.style.padding = '4px';
        mytitle.style.background = 'rgba(40, 40, 40, 0.8)';
        mytitle.style.border = 'solid 1px #e9f7f6';
        mytitle.style.borderRadius = '10px !important';
        mytitle.style.textAlign = 'center';
        mytitle.style.tableLayout = 'auto';
        mytitle.style.zIndex = '999';
    });
    ob.addEventListener('mouseout', function () {
        var mytitle = document.getElementById('mytitle');
        if (mytitle) {
            mytitle.parentNode.removeChild(mytitle);
        }
    });
    ob.addEventListener('mousemove', function (e) {
        var mytitle = document.getElementById('mytitle');
        if (mytitle) {
            //计算鼠标位置距离右边位置的值+10是否少于150px，如果少于反向显示title
            let w = window.innerWidth;
            let ww = e.pageX + x + 20 + 150;
            if (w >= ww) {
                mytitle.style.left = (e.pageX + x + 10) + 'px';
            } else {
                mytitle.style.left = (e.pageX - x - 10 - 150) + 'px';
            }
            let h = window.innerHeight;
            let hh = e.pageY + y - 20;
            let hhh = mytitle.scrollY;
            if (h >= hh) {
                mytitle.style.top = (e.pageY + y - 20) + 'px';
            } else {
                mytitle.style.top = (e.pageY - y + 20 - hhh) + 'px';
            }
            mytitle.style.display = 'block';

        }
    });
    ob.addEventListener('mousedown', function () {
        var mytitle = document.getElementById('mytitle');
        if (mytitle) {
            mytitle.parentNode.removeChild(mytitle);
        }
    });
}

const agCellClicks = () => {
    gridOption.value.getSelectedRows()[0].id = gridOption.value.getSelectedRows()[0].greyId
    emitter.emit('noPaiCanRowIdisXq', gridOption.value.getSelectedRows()[0])
}
</script>
<style>
html,
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overflow: hidden;
}

.gantt-chart {
    display: grid;
    grid-template-columns: 100px repeat(100, 1fr);
    /* grid-gap: 10px; */
    /* margin: 10px; */
}



.gantt-chart-header {
    background-color: #f1f1f1;

    font-weight: bold;
    position: sticky;
    top: 0;
    left: 0;
    height: 50px;
    line-height: 50px;
    text-align: center;

    width: 200px;
    white-space: nowrap;
    z-index: 998;

}

.gantt-chart-header-left {

    font-weight: bold;
    position: sticky;
    left: 0;
    width: 100px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    border-bottom: #ccc;
    background-color: #f1f1f1;
    white-space: nowrap;
    z-index: 997;

}

.gantt-chart-item {
    box-sizing: unset;
    background-color: #fff;
    border: 1px solid #ccc !important;
    border-radius: 5px;
    text-align: center;
    height: 50px;
    line-height: 50px;
    position: relative;
    white-space: nowrap;
    z-index: 1;
}

.gantt-chart-item .task-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 50px;
    line-height: 50px;
    border-radius: 5px;
    z-index: 2;
}

/* .gantt-chart-item .task-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.3); 
    z-index: 3;
  } */

/* .gantt-chart-item .task-title {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #fff;
    border-radius: 5px 5px 0 0;
    cursor: move;
    background-color: rgb(0, 0, 0, 0.5);
  
  } */

/* 左右布局 */
.container {
    display: flex;
    flex-direction: row;

}



.right {
    flex-grow: 1;
    background-color: #eee;
    overflow: auto;
    width: auto !important;
}

/* 左边样式 */
/* .left>div {
    margin-top: 2px;
    width: 250;
    height: 40px;
    line-height: 40px;
    background-color: #6d7bc9;
    color: white;
    padding: 5px;
    border-radius: 3px;
} */
:deep(.ag-cell) {
    border-right: 1px solid #ccc !important;
}

:deep(.ag-header-cell) {
    border-right: 1px solid #ccc !important;
}

.ag-ltr .ag-cell {
    border-right: 1px solid #ccc !important;
}

.ag-cell-value {
    user-select: initial;
    -moz-user-select: text;
    -ms-user-select: text;
    -webkit-user-select: text;
}

.arco-split-pane {
    overflow-y: hidden !important;
}

@media (min-width: 1670px) {
    .container {
        max-width: 1670px !important;
    }
}

.dialog-button {
    display: flex;
    justify-content: center;
    align-items: center;
}

.div_button {
    /* height: 64px;
    width: 60px; */
    position: absolute;
    z-index: 999;
    padding: 5px 10px;
    font-size: 14px;
    color: #fff;
    border: none;
    cursor: pointer;
}

/* .div_button .hoverDiv {
    display: none;
}

.div_button:hover .hoverDiv {
    display: block;
} */

.arco-split-trigger-vertical {
    height: 78vh;
    cursor: col-resize;
}

#LeftTopDiv {
    /* height: 60px;
    background-color: aquamarine !important; */
    margin-top: 5px;
    border-radius: 5%;
}


.main-section[data-v-22686b16] {
    overflow-y: hidden !important;
}

div.arco-typography,
p.arco-typography {
    margin-bottom: 0em !important;
}
</style>
  
  